//
// Created by lee on 24-6-26.
//

#ifndef DKS_AGX_THREADS_H
#define DKS_AGX_THREADS_H


#include "common/mavlink.h"
#include "struct_define.h"
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <mutex>
#include "decode.h"
#include "geo/geo.h"
#include <iostream>

extern map<uint8_t , AGX_2UAV_INFO_PACK> map_agx_2uav_info;

const useconds_t sleep_udp_receive = 100000, sleep_udp_send = 100000,
        sleep_mavlink_receive = 1000, sleep_mavlink_send = 100000;

void handle_message_mission_request_int(mavlink_message_t *msg);

void handle_message_mission_request(mavlink_message_t *msg);

void handle_message_mission_ack(mavlink_message_t* msg);

RECV_TYPE unpack_recv_data(uint8_t * raw_data,int& recv_len, uint8_t* unpacked_data);

uint8_t wayPointCheck(agx_2px4_route_single_t proutes[], int length);

void send_routes_mav(const char *ipAddr, int port);

void send_visual_inertial_test();

void send_route_test();

void udp_send(const char *ipAddr, int port);

void udp_receive(const char *ipAddr, int port);

void mavlink_send(int sockfd, const char *ipAddr, int port);

void mavlink_receive(int sockfd, const char *ipAddr, int port);


#endif //DKS_AGX_THREADS_H
